use bytes::BufMut;

use super::BodyEncode;




#[derive(Debug, Clone, Copy)]
pub struct Proto<T: BodyEncode> {
    pub ty: u8,
    pub seq: u8,
    pub src: u8,
    pub dst: u8,
    pub body: T,
}

pub struct Cmd<T: BodyEncode> {
    pub cmd: u8,
    pub body: T,
}


impl <T: BodyEncode> BodyEncode for Cmd<T> {

    fn encode(self, buf: &mut bytes::BytesMut) {
        buf.put_u8(self.cmd);
        self.body.encode(buf);
    }
}















